import type { PreOrder } from '@/types/cartItem'
import type { GoodsItem } from '@/types/goods'
import { http } from '@/utils/http'
//通过商品编号id查询商品详情
export const getGoodsByIdAPI = (id: number) => {
  return http<GoodsItem>({
    url: '/home/goods/findById',
    method: 'GET',
    data: { id },
  })
}

//立即购买
export const buyNowAPI = (userId: number, skuId: number, goodsCount: number) => {
  return http<PreOrder>({
    url: '/home/goods/guessLike/buyNow',
    method: 'POST',
    data: { userId, skuId, goodsCount },
  })
}
